import { fliterPermission } from '@/utils/sys.js'
export const apis = {
  list: `admin/basis/getList?modelCode=MODEL_TRANSPORT_TYPE&authCode=FUNCTION_TRANSPORT_TYPE_LIST`,
  del: `admin/transportType/del?authCode=BTN_TRANSPORT_TYPE_DEL`,
  add: `admin/transportType/add?authCode=BTN_TRANSPORT_TYPE_ADD`,
  edit: `admin/transportType/edit?authCode=BTN_TRANSPORT_TYPE_EDIT`,
  detail: `admin/transportType/detail?modelCode=MODEL_TRANSPORT_TYPE&authCode=BTN_TRANSPORT_TYPE_DETAIL`,
  state: `admin/transportType/state?authCode=BTN_TRANSPORT_TYPE_STATE`,
  
};

export const configs = {
  listUrl: apis.list,
  pageOn: true, // 开启分页
  searchOn: true, // 开启搜索
  operateOn: true, //开启操作区域
  treeOn: false, // 开启树形
};


export const searchs = [
  {
    type: "Input",
    column: "transport_type_name",
    label: "货品类型名称",
  },
 
  {
    type: "Select",
    column: "transport_type_state",
    label: "状态",
    dimCode: "DIM_TYPE_STATE"
  },
  {
    type: "DatePicker",
    column: "ctime",
    label: "创建日期",
  },
];

export const pages = {
  pageSize: 20,
  orders: [
    {
      field: "id",
      sort: "desc",
    },
  ]
};
export const columns = [
  { type: "selection" },
  {
    label: "ID",
    column: "id",
    sortable: "custom",
    
  },
  {
    label: "货品类型名称",
    column: "transport_type_name",
    display: "text",
  },
  {
    label: "货品类型编码",
    column: "transport_type_code",
    display: "text",
  },
  {
    label: "货品类型别名",
    column: "transport_type_alias",
    display: "text",
  },
  {
    label: "是否默认",
    column: "transport_type_default",
    display: "state",
    format:'dim'
  },
  
  {
    label: "状态",
    column: "transport_type_state",
    display: "state",
    format:'dim'
  },
  {
    label: "创建时间",
    column: "ctime",
    format: "datetime",
    display: "text",
  },
  { label: "操作", column: "operate", width: "240", fixed: "right" },
];

export const buttons = fliterPermission([
  {
    operate: "add",
    text: "新增",
    permission: 'BTN_TRANSPORT_TYPE_ADD',
  },
  {
    operate: "deleteAll",
    text: "删除",
    permission: 'BTN_TRANSPORT_TYPE_DEL',
    type: 'danger',
  },
  {
    operate: "stateOn",
    text: "启用",
    permission: 'BTN_TRANSPORT_TYPE_STATE',
  },
  {
    operate: "stateOff",
    text: "禁用",
    permission: 'BTN_TRANSPORT_TYPE_STATE',
  },
]);
export const columnButtons = fliterPermission([
  {
    operate: "detail",
    text: "详情",
    permission: 'BTN_TRANSPORT_TYPE_DETAIL',
  },
  {
    operate: "edit",
    text: "编辑",
    permission: 'BTN_TRANSPORT_TYPE_EDIT',
    hidden: ({ row })=> {
      return row.transport_type_default == 1;

    },

  },
  {
    operate: "delete",
    text: "删除",
    permission: 'BTN_TRANSPORT_TYPE_DEL',
    type: 'danger',
  }
]);
